Backports for 12005, 11670 and 12043.
* nsmenu.m (ns_update_menubar): Add braces to ambigous if-else.
* nsmenu.m (Popdown_data): New struct.
(pop_down_menu): p->pointer is Popdown_data. Release the pool and
free Popdown_data.
(ns_popup_dialog): Use NSAutoreleasePool and pass it to pop_down_menu.
(initWithContentRect): Make imgView and contentView non-static
and autorelease them. Also autorelease img and matrix.
(dealloc): Remove (Bug#12005).
* nsterm.m (keyDown:): Interpret flags without left/right bits
as the left key (Bug#11670).
* nsterm.m (ns_read_socket): Return early if there is a modal
window (Bug#12043).